class Animal {
    String name;
    int age;

    Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(name + "正在吃东西");
    }
}
class Dog extends Animal {
    Dog(String name, int age) {
        super(name,age);
    }

    public void eat() {
        System.out.println(name + "吃骨头");
    }
    public void bark() {
        System.out.println(name + "汪汪叫");
    }
}
class Cat extends Animal {
    Cat(String name,int age) {
        super(name,age);
    }

    public void eat() {
        System.out.println(name + "吃鱼干");
    }
}
class OutClass {
    int a;
    int b;

    public void func() {
        //System.out.println(this.a);
        class InnerClass1 {
            int c = 1254;
            void funcInner() {
                System.out.println(c);
            }
        }
        InnerClass1 innerclass1 = new InnerClass1();
        innerclass1.funcInner();
    }

    class InnerClass {
        int c;
        void funcInner() {
            OutClass.this.a = 101;
            System.out.println(OutClass.this.a);
        }
    }
}
abstract class People {
    public abstract void run();
}

public class Test {
    @FunctionalInterface
    interface People {
        void run();
    }
    public static void main3(String[] args) {
        People people1 = new People() {
            @Override
            public void run() {
                System.out.println("跑得快");
            }
        };
        People people2 = () -> {
            System.out.println("跑得很快");
        };
        people2.run();
    }
    public static void main(String[] args) {
        //OutClass outclass1 = new OutClass();
        //OutClass.InnerClass innerclass1 = outclass1.new InnerClass();
        //OutClass.InnerClass innerclass1 = new OutClass.InnerClass();
        //innerclass1.funcInner();
        OutClass outclass1 = new OutClass();
        outclass1.func();
    }
    public static void eat(Animal a) {
        a.eat();
    }
    public static void main1(String[] args) {
        Dog dog1 = new Dog("小七", 1);
        Cat cat1 = new Cat("元宝", 2);

        eat(dog1);
        eat(cat1);

        Animal animal1 = new Dog("小七", 1);
        animal1.eat();
        dog1 = (Dog)animal1;
    }
}